package estacion.persistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Conexion {
	private Connection bd;
	protected String url="jdbc:odbc:iso_2";
	private int id;

	public Conexion(int id) throws SQLException {
		this.id=id;
		this.url="jdbc:mysql://localhost:3306/iso_2";
		this.bd=DriverManager.getConnection(url, "root", "esiesi");
	}
	
	public void close() throws SQLException {
		synchronized (this) {
			Gestor_bbdd.get().libera(this);
		}
	}

	public int getId() {
		return id;
	}

	public PreparedStatement prepareStatement(String sql) throws SQLException {
		return this.bd.prepareStatement(sql);
	}

}
